package main

import (
	"context"
	"fmt"
	"log"

	pb "goproject/grpc/Demo/client/proto"

	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func main() {
	conn, err := grpc.NewClient("127.0.0.1:8080", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatalf("connect failed %v", err)
	}
	defer conn.Close()

	// 建立连接
	client := pb.NewHelloStudentClient(conn)
	resp, _ := client.HelloStudent(context.Background(), &pb.StudentRequest{Name: "grpc-client"})
	fmt.Println(resp.GetResponseMsg())
}
